package algorithms;


import org.springframework.expression.spel.ast.Selection;

import java.util.Arrays;
import java.util.Random;

/**
 * @功能
 * @创建时间 2020/5/17
 */
public class DataChecker {
    static int[] generateRandomArray(){
        Random r = new Random();
        int[] arr = new int[10000];
        for(int i = 0;i < arr.length; i++)
            arr[i] = r.nextInt(10000);
        return arr;
    }

    static void check(){
        int[] arr = generateRandomArray();
        int[] arr2 = new int[arr.length];
        System.arraycopy(arr,0,arr2,0,arr.length);
        Arrays.sort(arr);
        SelectionSort.sort(arr2);
        boolean same = true;
        for(int i = 0;i < arr2.length; i++){
            if(arr[i] != arr2[i])
                same = false;
        }
        System.out.println(same==true ? "right": "wrong");
    }

    public static void main(String[] args) {
        check();
    }
}
